SSFNET_DIR = /home/dongjin2/SVNROOT/ethernet_full_duplex/ssfnet
#SSFNET_DIR = /home/dongjin2/SVNROOT/ethernet_full_duplex_doff/ssfnet
MODEL_NAME = 2_to_1_1switch
VIRT_SPACE = 10.10.0.0
SIM_TIME =100 
OUT_FILE = a.out

all:	$(MODEL_NAME)-env.dml $(MODEL_NAME)-rt.dml

$(MODEL_NAME)-env.dml:	$(MODEL_NAME).dml
	$(SSFNET_DIR)/dmlenv -b $(VIRT_SPACE) $(MODEL_NAME).dml > $@

$(MODEL_NAME)-rt.dml:	$(MODEL_NAME).dml
	$(SSFNET_DIR)/dmlenv -r all $(MODEL_NAME).dml > $@

test:	$(MODEL_NAME)-env.dml $(MODEL_NAME)-rt.dml
	@ if ./test.run "$(SSFNET_DIR)/ssfnet -silent -q 100 *.dml"; then \
	  echo "------------------"; \
	  echo "mac/tcp_10_hosts/tcp_10_hosts PASSED"; \
	  echo "------------------"; \
	else \
	  echo "------------------"; \
	  echo "mac/tcp_10_hosts/tcp_10_hosts FAILED"; \
	  echo "------------------"; \
	fi

run:	$(MODEL_NAME)-env.dml $(MODEL_NAME)-rt.dml
	$(SSFNET_DIR)/ssfnet $(SIM_TIME) $(MODEL_NAME).dml $(MODEL_NAME)-env.dml $(MODEL_NAME)-rt.dml > $(OUT_FILE)

analyze:	tcp_20_hosts.tcpdump
	perl seqplot.pl
	gnuplot seq.gplot
	gnuplot wnd.gplot

clean:
	rm -f $(MODEL_NAME)-env.dml $(MODEL_NAME)-rt.dml *.out *.tcpdump cwnd* ackno seqno *~ .tmpdat*
